package com.loto;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.text.ParseException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

import com.loto.graphics.*;

public class Launcher {

	/**
	 * @param args
	 * @throws ParseException
	 */
	public static void main(String[] args) throws ParseException {
		for (UIManager.LookAndFeelInfo laf : UIManager
				.getInstalledLookAndFeels()) {
			if ("Nimbus".equals(laf.getName())) {
				try {
					UIManager.setLookAndFeel(laf.getClassName());

				} catch (Exception e) {
					// TODO: handle exception
				}

			}
		}
		JFrame menu = new JFrame("Menu");
		JButton stat = new JButton("Statitisques");
		JPanel panel = new JPanel();
		stat.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					try {
						SecondFrame SecondFrame = new SecondFrame(1);
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				} catch (ParseException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		JButton see = new JButton("Affichage");
		see.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				try {
					SecondFrame SecondFrame = new SecondFrame(2);
				} catch (ParseException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}
		});

		JButton game = new JButton("Game");
		game.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					SecondFrame SecondFrame = new SecondFrame(3);
				} catch (ParseException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}

			}
		});
		JButton quit = new JButton("Quitter");
		quit.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				System.exit(0);
			}
		});
		panel.add(see);
		panel.add(game);
		panel.add(stat);
		panel.add(quit);
		menu.add(panel);
		menu.setVisible(true);
		menu.pack();
		menu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

}
